//
//  HJNetworking.h
//  KaiChat
//
//  Created by lx on 2023/10/16.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

NSURLSessionDownloadTask * HJDownloadFileWithUrl(NSString *url,void (^progress)(CGFloat value), NSURL *(^destination)(void), void (^complete)(NSError * _Nullable error));


@interface HJNetworking : NSObject

+ (HJNetworking *)shareNetwork;

- (void)POST:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)POSTBodyJSON:(NSString *)url
  parameters:(nullable id)parameters
     success:(void (^__nullable)(NSDictionary *responseObject, id data))success
     failure:(void (^__nullable)(NSError *error))failure;

- (void)GET:(NSString *)url
 parameters:(nullable id)parameters
    success:(void (^__nullable)(NSDictionary *responseObject, id data))success
    failure:(void (^__nullable)(NSError *error))failure;

- (void)uploadImageWithUrl:(NSString *)url
                 fileData:(NSData *)fileData
                  fileKey:(NSString *)fileKey
                progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
                  success:(void (^)(NSDictionary *responseObject, id data))success
                   failure:(void (^)(NSError *error))failure;

- (void)uploadImageWithObejctKey:(NSString *)obejctKey
                 fileData:(NSData *)fileData
                        progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
                  success:(void (^)(NSDictionary *responseObject, id data))success
                     failure:(void (^)(NSError *error))failure;

@end


NS_ASSUME_NONNULL_END
